#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>

void* Routine(void* arg)
{
	char* msg = (char*)arg;
	while (1){
		printf("I am %s\n", msg);
		sleep(1);
	}
}
int main()
{
	pthread_t tid[5];
    for(int i = 0 ; i < 5 ; i++)
    {
        char* buff = (char*)malloc(64);
        sprintf(buff,"thread%d",i);
        pthread_create(&tid[i],NULL,Routine,buff);
    }
	while (1){
		printf("I am main thread!\n");
		sleep(2);
	}
	return 0;
}
